﻿using RRRSRoguelikeData;
using System.Linq;
namespace RRRSRoguelike.Helpers
{
	/// <summary>
	/// Describes high score.
	/// </summary>
	public static class HighScoreHelper
	{
		/// <summary>
		/// Takes HighScoreData and returns a unique ID value.
		/// </summary>
		/// <param name="data"></param>
		/// <returns></returns>
		public static string GetUniqueID(HighScoreData data)
		{
			int i=0;

			//FIXME: backup and replace broken .sav on error.
			while(data.Entries.Where(t => t.Data["ID"]==i.ToString()).Count()>0)
			{
				i++;
			}

			return i.ToString();
		}
	}
}
